package ie.dkit.java3Demulation.objects3d;

import java.util.ArrayList;
import java.util.Collection;

import ie.dkit.java3Demulation.drawer.Line3DDrawable;
import ie.dkit.java3Demulation.transforming.Transformable;

public class Quader implements Line3DDrawable, Transformable {

	private String name;

	private Point3D rotationPoint;

	private Point3D leftFrontUp;

	private Point3D leftFrontBottom;

	private Point3D rightFrontBottom;

	private Point3D rightFrontUp;

	private Point3D leftBackUp;

	private Point3D leftBackBottom;

	private Point3D rightBackBottom;

	private Point3D rightBackUp;

	public Quader() {
		name = "Quader";
		leftFrontUp = new Point3D(0, 100, -100);
		leftFrontUp.setName("leftFrontUp");
		leftFrontBottom = new Point3D(0, 0, -100);
		leftFrontBottom.setName("leftFrontBottom");
		rightFrontBottom = new Point3D(100, 0, -100);
		rightFrontBottom.setName("rightFrontBottom");
		rightFrontUp = new Point3D(100, 100, -100);
		rightFrontUp.setName("rightFrontUp");
		leftBackUp = new Point3D(0, 100, 0);
		leftBackUp.setName("leftBackUp");
		leftBackBottom = new Point3D(0, 0, 0);
		leftBackBottom.setName("leftBackBottom");
		rightBackBottom = new Point3D(100, 0, 0);
		rightBackBottom.setName("rightBackBottom");
		rightBackUp = new Point3D(100, 100, 0);
		rightBackUp.setName("rightBackUp");
	}

	public Quader(Point3D leftFrontUp, Point3D leftFrontBottom,
			Point3D rightFrontBottom, Point3D rightFrontUp, Point3D leftBackUp,
			Point3D leftBackBottom, Point3D rightBackBottom, Point3D rightBackUp) {
		super();
		this.leftFrontUp = leftFrontUp;
		this.leftFrontBottom = leftFrontBottom;
		this.rightFrontBottom = rightFrontBottom;
		this.rightFrontUp = rightFrontUp;
		this.leftBackUp = leftBackUp;
		this.leftBackBottom = leftBackBottom;
		this.rightBackBottom = rightBackBottom;
		this.rightBackUp = rightBackUp;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see ie.dkit.java3Demulation.transforming.Transformable#getPoints()
	 */
	public Collection<Point3D> getPoints() {
		Collection<Point3D> returnValue = new ArrayList<Point3D>();
		returnValue.add(leftFrontUp);
		returnValue.add(leftFrontBottom);
		returnValue.add(rightFrontBottom);
		returnValue.add(rightFrontUp);
		returnValue.add(leftBackUp);
		returnValue.add(leftBackBottom);
		returnValue.add(rightBackBottom);
		returnValue.add(rightBackUp);
		return returnValue;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see ie.dkit.java3Demulation.transforming.Transformable#getRotationPoint()
	 */
	public Point3D getRotationPoint() {
		return rotationPoint;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see ie.dkit.java3Demulation.transforming.Transformable#setRotationPoint(ie.dkit.java3Demulation.objects3d.Point3D)
	 */
	public void setRotationPoint(Point3D point3D) {
		rotationPoint = point3D;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see ie.dkit.java3Demulation.objects.GraphicsObject#getName()
	 */
	public String getName() {
		return name;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see ie.dkit.java3Demulation.objects.GraphicsObject#setName(java.lang.String)
	 */
	public void setName(String name) {
		this.name = name;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see ie.dkit.java3Demulation.drawer.LineDrawable#getLines()
	 */
	public Collection<Line3D> getLines() {
		Collection<Line3D> returnValue = new ArrayList<Line3D>();
		returnValue.addAll(new Rectangle(leftFrontUp, leftFrontBottom,
				rightFrontUp, rightFrontBottom).getLines());
		returnValue.addAll(new Rectangle(leftBackUp, leftBackBottom,
				rightBackUp, rightBackBottom).getLines());
		returnValue.add(new Line3D(leftFrontUp, leftBackUp));
		returnValue.add(new Line3D(leftFrontBottom, leftBackBottom));
		returnValue.add(new Line3D(rightFrontUp, rightBackUp));
		returnValue.add(new Line3D(rightFrontBottom, rightBackBottom));
		return returnValue;
	}

	public Point3D getLeftBackBottom() {
		return leftBackBottom;
	}

	public void setLeftBackBottom(Point3D leftBackBottom) {
		this.leftBackBottom = leftBackBottom;
	}

	public Point3D getLeftBackUp() {
		return leftBackUp;
	}

	public void setLeftBackUp(Point3D leftBackUp) {
		this.leftBackUp = leftBackUp;
	}

	public Point3D getLeftFrontBottom() {
		return leftFrontBottom;
	}

	public void setLeftFrontBottom(Point3D leftFrontBottom) {
		this.leftFrontBottom = leftFrontBottom;
	}

	public Point3D getLeftFrontUp() {
		return leftFrontUp;
	}

	public void setLeftFrontUp(Point3D leftFrontUp) {
		this.leftFrontUp = leftFrontUp;
	}

	public Point3D getRightBackBottom() {
		return rightBackBottom;
	}

	public void setRightBackBottom(Point3D rightBackBottom) {
		this.rightBackBottom = rightBackBottom;
	}

	public Point3D getRightBackUp() {
		return rightBackUp;
	}

	public void setRightBackUp(Point3D rightBackUp) {
		this.rightBackUp = rightBackUp;
	}

	public Point3D getRightFrontBottom() {
		return rightFrontBottom;
	}

	public void setRightFrontBottom(Point3D rightFrontBottom) {
		this.rightFrontBottom = rightFrontBottom;
	}

	public Point3D getRightFrontUp() {
		return rightFrontUp;
	}

	public void setRightFrontUp(Point3D rightFrontUp) {
		this.rightFrontUp = rightFrontUp;
	}
}
